package com.weilai.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.weilai.pojo.TbItem;
import com.weilai.servcie.TbItemService;


@Controller
public class ItemController {
	
	@Autowired
	private TbItemService tbItemService;

	@RequestMapping("/item/{id}")
	@ResponseBody
	public TbItem  getItemById(@PathVariable Long id){
		TbItem i = tbItemService.findById(id);
		return i;
	};
	
	
	@RequestMapping("/{page}")
	public String showPage(@PathVariable String page){
		return page;
	}
	
	@RequestMapping("/item-list")
	public String itemList(){
		return "/item-list";
	}
	
}
